import { getCommentList } from '@/api/comment'
export default {
  namespaced: true,
  state() {
    return {
      momentList: [],
      userId: '',
    }
  },
  mutations: {
    setMomentList(state, payload) {
      state.momentList = payload
    },
    setUserId(state, payload) {
      state.userId = payload
    },
  },
  actions: {
    getCommentListFn({ commit }, id) {
      getCommentList(id).then(res => {
        if (res.data) {
          commit('setMomentList', res.data)
        } else {
          commit('setMomentList', [])
        }
      })
    }
  }

}